package com.qwt.server.advice;

import lombok.Data;

/**
 * 自定义异常类
 * @author 时光
 * @date 2021/12/10 15:4020
 */
@Data
public class FException extends RuntimeException{
    private static final long serialVersionUID = 1L;
    private String msg;
    private int code = 500;

    private FException(String msg) {
        super(msg);
        this.msg = msg;
    }

    private FException(String msg, Throwable e) {
        super(msg, e);
        this.msg = msg;
    }

    private FException(String msg, int code) {
        super(msg);
        this.msg = msg;
        this.code = code;
    }

    private FException(String msg, int code, Throwable e) {
        super(msg, e);
        this.msg = msg;
        this.code = code;
    }

    public static FException of(String msg){
        return new FException(msg);
    }
    public static FException of(String msg, Throwable e){
        return new FException(msg,e);
    }
    public static FException of(String msg, int code){
        return new FException(msg,code);
    }
    public static FException of(String msg, int code, Throwable e){
        return new FException(msg,code,e);
    }

}
